/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = wtc_tcb_codeset.c                                  */
/*  NOTE      =                                                    */
/*  DATE      = 2015/08/27 by songbb                               */
/*******************************************************************/

#include "conntrack.h"

#include "../wtc_core.h"
#include "../wtc_comm.h"
#include "../wtc_mar.h"
#include "wtc_tcb_codeset.h"

int wtc_tcb_codeset_tmpostrecv(Conntrack *p_st_conn
                            , Apm_packet *p_analyze_in
                            , L7session_wtc *p_st_sess
                            , L7_wtc_packet *p_st_wtc_packet
                            , int i_recv_size
                            , int i_hint_index)
{
    unsigned int ui_encode_len = 0;
    wtc_free((void **) &(p_st_sess->p_codeset_encoding));

    if (wtc_mar_decode_string(p_st_sess, NULL, 0, p_st_wtc_packet, &(p_st_sess->p_codeset_encoding), &ui_encode_len) != FR_SUCC)
        goto error;

    WTC_PRINT_FATAL("p_encode:[%s]\n", p_st_sess->p_codeset_encoding);

    return FR_SUCC;
error:
    wtc_free((void **) &(p_st_sess->p_codeset_encoding));
    return FR_FAIL;
}

int wtc_tcb_codeset_tmpostrecv_fad(char *p_payload
                                , unsigned int ui_payload_len
                                , unsigned int *p_ui_offset
                                , int *p_i_direction
                                , int i_recv_size
                                , int i_hint_index)
{
    return wtc_skip_string(p_payload, ui_payload_len, p_ui_offset);
}
